package com.aegean.MonitorExamSYS.android.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.MonitorExamSYS.monitor.business.MonitorBusiness;
import com.aegean.MonitorExaxSYS.model.MonitorValue;
import com.opensymphony.xwork2.ActionSupport;

@Controller("MonitorLoginForAndroid")
@Scope("prototype")
public class MonitorLoginForAndroid extends ActionSupport {
	@Resource
	MonitorBusiness business;
	private int unit_Id;
	private MonitorValue monitor;
	private boolean success;

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public int getUnit_Id() {
		return unit_Id;
	}

	public void setUnit_Id(int unit_Id) {
		this.unit_Id = unit_Id;
	}

	public MonitorValue getMonitor() {
		return monitor;
	}

	public void setMonitor(MonitorValue monitor) {
		this.monitor = monitor;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		monitor = business.loginMonitor(monitor, unit_Id);
		if (monitor == null) {
			success = false;
		} else {
			success = true;
		}
		return SUCCESS;
	}

}
